package lucene.news;

import lion.se.lucene.index.IDocumentBuilder;

import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.TextField;

/**
 * @author lion
 * @email hl_0074@sina.com
 * @date 2014年4月15日
 */
public class NewsDocumentBuilder implements IDocumentBuilder {

	private News news;

	public NewsDocumentBuilder(News news) {

		this.news = news;
	}

	@Override
	public Document build() {

		Document document = new Document();
		document.add(new TextField("title", news.getTitle(), Store.YES));
		document.add(new TextField("content", news.getContent(), Store.YES));

		return document;
	}
}
